#region MIT Licence
/*
Copyright (c) 2007 Mono Overlay Routing Foundation Team

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

 */
#endregion


using System;
using System.Net;


namespace MonORF.Overlay {
   
   public class ChimeraHost
   {
      private Key m_key;
      private IPAddress m_address;
      
      //      private readonly Single m_goodLink;
      //      private readonly Single m_badLink;
      private Single m_success_avg;
      private String m_hostName;
      

      //private UInt32 m_address;
      
      private Int32 m_failed;
      
      private Double m_failuretime;
      private Int32 m_port;
      

      private Double m_latency;
      

      private Double m_loss;
      

      private Double m_success;
      

      public ChimeraHost(String hostName, IPAddress addr) {
         m_port = 0;
         m_key = new Key(hostName,1,new UInt32[]{1,1,1,1,1});
         m_success = 0;
         m_latency = 0;
//         m_goodLink = 0.8F;
//         m_badLink = 0.3F;
         m_hostName = hostName;
         m_loss = 0;
         m_failuretime = Double.NaN;
         m_failed = 0;
         //m_address = 0;
         m_success_avg = 0.0F;
      }
      
      public String HostName {
         get { return m_hostName; }
         set { m_hostName = value; }
      }
      
      public Key Key {
         get { return m_key; }
         set { m_key = value; }
      }
      
      public Double Success {
         get { return m_success; }
         set { m_success = value; }
      }
      
      public Double Loss {
         get { return m_loss; }
         set { m_loss = value; }
      }
      
      public Double Latency {
         get { return m_latency; }
         set { m_latency = value; }
      }
      
      public Int32 Port {
         get { return m_port; }
         set { m_port = value; }
      }

      
      public Double Failuretime {
         get { return m_failuretime; }
         set { m_failuretime = value; }
      }

      
      public Int32 Failed {
         get { return m_failed; }
         set { m_failed = value; }
      }
      
      
//      public UInt32 Address {
//         get { return m_address; }
//         set { m_address = value; }
//      }

      
      public Single SuccessAvg {
         get { return m_success_avg; }
         set { m_success_avg = value; }
      }

      public IPAddress IPAddress {
         get {
            return m_address;
         }
         set {
            m_address = value;
         }
      }

      public IPEndPoint GetIPEndPoint(){
         return new IPEndPoint(m_address, m_port);
      }
   }
}
